<div class="content-wrapper">

    <section class="content-header">
        <?php echo $this->partial('layout/breadcrumb'); ?>
        <h1 class="pull-right">
            <?php echo $this->HelpUrl('orderPaymentLog'); ?>
        </h1>
    </section>

    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box shop-box">
                    <div class="box-body table-responsive no-padding">
                        <table class="table shop-table table-hover">
                            <thead>
                            <tr class="shop-bg-thead">
                                <th width="20%"><?php echo $this->translate('订单编号'); ?></th>
                                <th width="10%"><?php echo $this->translate('金额'); ?></th>
                                <th width="10%"><?php echo $this->translate('支付方式'); ?></th>
                                <th width="15%"><?php echo $this->translate('下单时间'); ?></th>
                                <th width="10%"><?php echo $this->translate('购买人'); ?></th>
                                <th width="10%"><?php echo $this->translate('支付状态'); ?></th>
                                <th width="15%"><?php echo $this->translate('支付时间'); ?></th>
                                <th width="10%"></th>
                            </tr>
                            <?php
                            $sForm = $this->searchForm;
                            $sForm->prepare();
                            $sForm->get('payment_code')->setEmptyOption('选择支付');
                            $sForm->get('payment_state')->setEmptyOption('选择状态');
                            ?>
                            <?php echo $this->form()->openTag($sForm); ?>
                            <tr>
                                <td>
                                    <?php echo $this->formElement($sForm->get('order_sn')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('order_sn'), ['class'=>'error-message']);?>
                                </td>
                                <td></td>
                                <td>
                                    <?php echo $this->formElement($sForm->get('payment_code')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('payment_code'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <p>
                                        <?php echo $this->formElement($sForm->get('start_time')); ?>
                                    </p>
                                    <div>
                                        <?php echo $this->formElement($sForm->get('end_time')); ?>
                                    </div>
                                    <?php echo $this->formElementErrors($sForm->get('start_time'), ['class'=>'error-message']);?>
                                    <?php echo $this->formElementErrors($sForm->get('end_time'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <?php echo $this->formElement($sForm->get('user_name')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('user_name'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <?php echo $this->formElement($sForm->get('payment_state')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('payment_state'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <p>
                                        <?php echo $this->formElement($sForm->get('start_payment_time')); ?>
                                    </p>
                                    <div>
                                        <?php echo $this->formElement($sForm->get('end_payment_time')); ?>
                                    </div>
                                    <?php echo $this->formElementErrors($sForm->get('start_payment_time'), ['class'=>'error-message']);?>
                                    <?php echo $this->formElementErrors($sForm->get('end_payment_time'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <button type="submit" class="btn btn-info btn-sm"><i class="fa fa-search"></i></button>
                                    <?php
                                    $formData = array_filter($sForm->getData());
                                    if(!empty($formData)) { ?>
                                        &nbsp;&nbsp;<a href="<?php echo $this->url('sales', ['action' => 'orderPaymentLog']);?>" class="btn btn-default btn-sm"><i class="fa fa-reply"></i></a>
                                    <?php } ?>
                                </td>
                            </tr>
                            <?php echo $this->form()->closeTag(); ?>
                            </thead>
                            <tbody>
                            <?php if($this->paymentLogList->getCurrentItemCount() > 0) foreach ($this->paymentLogList as $logValue) { ?>
                                <tr>
                                    <td><?php echo $this->escapeHtml($logValue->getOrderSn()); ?></td>
                                    <td><?php echo $logValue->getCurrencySymbol().$logValue->getOrderAmount(); ?></td>
                                    <td><?php echo $this->escapeHtml($logValue->getPaymentName()); ?></td>
                                    <td><?php echo $this->shopDateFormat()->orderTime($logValue->getOrderAddTime()); ?></td>
                                    <td><?php echo $this->escapeHtml($logValue->getUserName()); ?></td>
                                    <td><?php echo $logValue->getPaymentFinishTime() ? $this->translate('已支付') : $this->translate('未支付'); ?></td>
                                    <td colspan="2"><?php echo $logValue->getPaymentFinishTime() ? $this->shopDateFormat()->orderTime($logValue->getPaymentFinishTime()) : ''; ?></td>
                                </tr>
                            <?php } ?>
                            </tbody>
                        </table>
                    </div>
                    <div class="box-footer clearfix">
                        <?php echo $this->paginationControl($this->paymentLogList, 'Sliding', 'layout/page', ['route' => 'sales', 'params' => ['action' => 'orderPaymentLog']]); ?>
                    </div>
                </div>
            </div>
        </div>

    </section>
</div>
<script>
    laydate.render({elem: '#start_time'});
    laydate.render({elem: '#end_time'});

    laydate.render({elem: '#start_payment_time'});
    laydate.render({elem: '#end_payment_time'});
</script>